# Importing Data
ARGENTINA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "B1:B229")

# Checking the Imported Data
View(ARGENTINA)
# Creating Time Series Data
ARGENTINA_ts <- ts(ARGENTINA, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
ARGENTINA_ts
sum(is.na(ARGENTINA_ts))
library(forecast)
ARGENTINA_ts <- tsclean(ARGENTINA_ts)
ARGENTINA_ts

# Identification: Plotting the Time Series Data
plot(ARGENTINA_ts)

# Estimating the appropriate model
ARGENTINA_ts_model <- auto.arima(ARGENTINA_ts)
ARGENTINA_ts_model

# Forecasting
options(max.print=1000000)
ARGENTINA_ts_forecast <- forecast (ARGENTINA_ts_model, level=c(95), h=288)
plot(ARGENTINA_ts_forecast)
ARGENTINA_ts_forecast             

# Exporting
write.table(ARGENTINA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/ARGENTINA_TSA.csv", sep=",")
